home *** CD-ROM | disk | FTP | other *** search
- // GETINFO SCRIPTING
- // Cineguide (Cinebel) - Dutch (BE) import
-
- (***************************************************
- * Movie importation script for: *
- * CINEGUIDE DUTCH (BE), http://www.cineguide.be *
- * *
- * Script made by Epsilon *
- * New version made by Antoine Potten *
- * *
- * For use with Ant Movie Catalog 3.4.0 *
- * www.antp.be/software/moviecatalog *
- * *
- * This program is free software; you can *
- * redistribute it and/or modify it under the *
- * terms of the GNU General Public License as *
- * published by the Free Software Foundation; *
- * either version 2 of the License, or (at your *
- * option) any later version. *
- ***************************************************)
-
- program CINEGUIDE_NL;
- var
- MovieName: string;
-
- function FindLine(Pattern: string; List: TStringList; StartAt: Integer): Integer;
- var
- i: Integer;
- begin
- result := -1;
- if StartAt < 0 then
- StartAt := 0;
- for i := StartAt to List.Count-1 do
- if Pos(Pattern, List.GetString(i)) <> 0 then
- begin
- result := i;
- Break;
- end;
- end;
-
- procedure AnalyzePage(Address: string);
- var
- PageText: string;
- Block: string;
- ResultBlock: Integer;
- BeginPos, EndPos: Integer;
- ValueTitle, ValueAddress: string;
- begin
- PageText := GetPage(Address);
- if pos('<a href=/fr/film.asp', PageText) > 0 then
- begin
- SetField(fieldURL, Address);
- AnalyzeMoviePage(PageText)
- end
- else
- begin
- PickTreeClear;
- ResultBlock := Pos('<td class="cadre" height="16">', PageText);
- while ResultBlock > 0 do
- begin
- Delete(PageText, 1, ResultBlock + 35);
- EndPos := Pos('</td>', PageText);
- PickTreeAdd(StringReplace(Copy(PageText, 1, EndPos - 1), #13#10 + ' ', ''), '');
- BeginPos := EndPos;
- EndPos := Pos('<td height="10"> </td>', PageText);
- Block := Copy(PageText, BeginPos, EndPos - BeginPos);
- Delete(PageText, 1, EndPos);
- BeginPos := Pos('<a href="/nl/film.asp', Block);
- while BeginPos > 0 do
- begin
- Delete(Block, 1, BeginPos - 1);
- EndPos := Pos('</a>', Block);
- ValueTitle := Copy(Block, 1, EndPos - 1);
- HTMLRemoveTags(ValueTitle);
- BeginPos := Pos('"', Block);
- EndPos := Pos('" class', Block);
- ValueAddress := 'http://www.cinebel.be' + Copy(Block, BeginPos + 1, EndPos - BeginPos - 1);
- PickTreeAdd(ValueTitle, ValueAddress);
- EndPos := Pos('</td>', Block);
- Delete(Block, 1, EndPos);
- BeginPos := Pos('<a href="/nl/film.asp', Block);
- end;
- ResultBlock := Pos('<td class="cadre" height="16">', PageText);
- end;
- if PickTreeExec(Address) then
- AnalyzePage(Address);
- end;
- end;
-
- procedure AnalyzeMoviePage(PageText: string);
- var
- Line, Value: string;
- IntValue: Integer;
- BeginPos, EndPos: Integer;
- begin
- BeginPos := Pos('<table border="0" width="95%" cellpadding="0" cellspacing="0">', PageText);
- Delete(PageText, 1, BeginPos);
-
- // Original Title
- BeginPos := Pos('<b class="cadre">', PageText);
- Delete(PageText, 1, BeginPos + 16);
- EndPos := Pos ('</b>', PageText);
- Value := Copy(PageText, 1, EndPos - 1);
- SetField(fieldOriginalTitle, Value);
-
- // Country & Year
- BeginPos := Pos(' - ', PageText) + 3;
- EndPos := Pos('</td>', PageText);
- Line := Copy(PageText, BeginPos, EndPos - BeginPos);
- EndPos := Pos(' - ', Line);
- SetField(fieldCountry, Copy(Line, 1, EndPos - 1));
- Delete(Line, 1, EndPos + 2);
- EndPos := Pos(#13#10, Line);
- SetField(fieldYear, Copy(Line, 1, EndPos - 1));
-
- // Description
- BeginPos := Pos('<hr noshade width="100%" size="1" color="#000000">', PageText);
- Delete(PageText, 1, BeginPos);
- EndPos := Pos('<hr noshade width="100%" size="1" color="#000000">', PageText);
- Line := Copy(PageText, 1, EndPos - 1);
- Delete(PageText, 1, EndPos);
- BeginPos := Pos('>', Line);
- Delete(Line, 1, BeginPos);
- Line := StringReplace(Trim(StringReplace(Line, #13#10, '')), '<br>', #13#10);
- SetField(fieldDescription, Line);
-
- // Director
- BeginPos := Pos('<b>Regisseur', PageText);
- Delete(PageText, 1, BeginPos);
- BeginPos := Pos('</b> ', PageText) + 5;
- EndPos := Pos('</td>', PageText);
- Value := Copy(PageText, BeginPos, EndPos - BeginPos);
- HTMLRemoveTags(Value);
- SetField(fieldDirector, Value);
-
- // Actors
- BeginPos := Pos('<b>Acteurs', PageText);
- Delete(PageText, 1, BeginPos);
- BeginPos := Pos(' </b>', PageText) + 5;
- EndPos := Pos('</td>', PageText);
- Value := Copy(PageText, BeginPos, EndPos - BeginPos);
- Value := StringReplace(Value, ' ', '');
- Value := StringReplace(Value, #13#10, '');
- HTMLRemoveTags(Value);
- SetField(fieldActors, Trim(Value));
-
- // Category
- BeginPos := Pos('<b>Genre', PageText);
- Delete(PageText, 1, BeginPos);
- BeginPos := Pos('</b> ', PageText) + 5;
- EndPos := Pos('</td>', PageText);
- Value := Copy(PageText, BeginPos, EndPos - BeginPos);
- EndPos := Pos(#13#10, Value);
- SetField(fieldCategory, Copy(Value, 1, EndPos - 1));
-
- // Length
- BeginPos := Pos('<b>Duur', PageText);
- Delete(PageText, 1, BeginPos);
- BeginPos := Pos(' </b>', PageText) + 5;
- EndPos := Pos(' </td>', PageText);
- Value := Copy(PageText, BeginPos, EndPos - BeginPos);
- EndPos := Pos('.', Value);
- IntValue := StrToInt(Copy(Value, 1, EndPos - 1), 0) * 60;
- IntValue := IntValue + StrToInt(Copy(Value, EndPos + 1, Length(Value)), 0);
- SetField(fieldLength, IntToStr(IntValue));
-
-
-
- DisplayResults;
- end;
-
- begin
- if CheckVersion(3,4,0) then
- begin
- MovieName := GetField(fieldOriginalTitle);
- if MovieName = '' then
- MovieName := GetField(fieldTranslatedTitle);
- if Input('Cineguide (Cinebel) Import', 'Enter the title (or the URL) of the movie:', MovieName) then
- begin
- if Pos('cinebel.be', MovieName) > 0 then
- AnalyzePage(MovieName)
- else
- AnalyzePage('http://www.cinebel.be/nl/srch.asp?mot='+UrlEncode(MovieName));
- end;
- end else
- ShowMessage('This script requires a newer version of Ant Movie Catalog (at least the version 3.4.0)');
- end.
-
-